
<div>
<style>
.markposbox{
width:350px;
}
.markposbox li{
	width:100px;
	float:left;
	border:1px solid #CCC;
	margin:2px;
}
 

</style>

<!-- 获取导航 -->
<#assign navigationTag=newTag("navigationTag")>
<#assign homePage=navigationTag("{'page_name':'navigation.html'}")>


<div class="main" style="background-color: white;">
<#-- 修改点击“设置”-“系统设置”后台菜单后挂件错误 by tito-->
<#-- <input type="hidden" name="site_seting.themeid" value="" />
<input type="hidden" name="site_seting.themepath" value="" />
<input type="hidden" name="site_seting.adminthemeid" value="" />
-->
<a href="javascript:void(0)" style="margin:0 auto;" class="button blueButton" data-options="iconCls:'icon-add',plain:true" onclick="add()">增加导航</a>
	<form id="navigation_form">
		<table class="form-table">
			<#list homePage.paramList as param>
			<tr>
				<th>
					导航${param_index+1}：    
				</th>
				<td>
					<input type="text" class="input_text combo" name="title" style="width:300px" value="${param.title}"/>
				</td>
				<th>
					url： 
				</th>
				<td>
					<input type="text" class="input_text combo" name="url" style="width:300px" value="${param.url}"/>
					<a href="javascript:void(0)" style="margin:0 auto;" class="button blueButton" data-options="iconCls:'icon-add',plain:true" onclick="deleted(this)">删除</a>
				</td>
			</tr>
			</#list>
			
	
		</table>
		</div>
		
		<div style="width:350px;height:50px;border:0px solid #000000;margin:0 auto;">
			<a href="javascript:void(0)" style="margin:0 auto;" class="button blueButton" data-options="iconCls:'icon-add',plain:true" onclick="save()">保存</a>
		</div>
	</form>
	
<script>
function getLogoPath(path){
	$("#logofile").attr("src",path);
	
	$("#logofile_url").val(path);
}

  

function save(){
	var options = {
		url :"${ctx}/core/admin/navigation/save.do",
		type : "POST",
		dataType : 'json',
		success : function(result) {				
		 	if(result.result==1){
		 		
		 		alert(result.message);
		 		
		 		
		 		location.reload();
		 	}else if(result.result==0){
		 		
		 		$("body").overhang({
	 			  type: "error",
	 			  message: result.message
		 		});
		 	}
		},
		error : function(e) {
			$("body").overhang({
 			  type: "error",
 			  message: "请求错误！"
	 		});
		}
	};
	$("#navigation_form").ajaxSubmit(options);
	
}

function add(){
	
	var size=$(".form-table").find("tr").length;
	var newsize=size+1;
	var html="<tr><th>导航"+newsize+"</th><td><input type='text' class='input_text combo' name='title' style='width:300px' value=''/>"
				+"</td><th>url：</th><td><input type='text' class='input_text combo' name='url' style='width:300px' value=''/>"
				+"<a href='javascript:void(0)' style='margin:0 auto;' class='button blueButton' "
				+"data-options='iconCls:'icon-add',plain:true' onclick='deleted(this)'>删除</a></td></tr>";
	$(".form-table").append(html);
	
}

function deleted(obj){
	var tr=$(obj).parent().parent();
	tr.remove();
}


$(function(){
	
	$("#uploadLogoBtn").click(function(){
		openImgDlg(getLogoPath)
	});
	 		
});
</script>
</div>